/**
 * 配置
 * */
package org.zmhhxl.sample3.oauth2.a.handler;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;

import java.io.IOException;

@Slf4j
public class LoginOAuthSuccessHandler implements AuthenticationSuccessHandler {

   private final AuthenticationSuccessHandler delegate = new SavedRequestAwareAuthenticationSuccessHandler();

   /**
    * Called when a user has been successfully authenticated.
    *
    * @param request        the request which caused the successful authentication
    * @param response       the response
    * @param authentication the <tt>Authentication</tt> object which was created during
    */
   @Override
   public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {

      this.delegate.onAuthenticationSuccess(request, response, authentication);
   }
}
